//
//  AppDelegate.swift
//  UniversalTool
//
//  Created by LGB on 2025/3/1.
//
import IQKeyboardManagerSwift

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
    
    var window: UIWindow?
    var launchManager: UTLaunchManager?
    var isForceLandscape: Bool = false
    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        configurationRootViewController()
        configurationKeyboard()
        configurationDatas()
        return true
    }
    
    func configurationRootViewController() {
        window = UIWindow.init(frame: UIScreen.main.bounds)
        window?.backgroundColor = .white
        let vc = UTHomeViewController()
        let navigationVC = UTBaseNavigationController(rootViewController: vc)
        window?.rootViewController = navigationVC
        window?.makeKeyAndVisible()
        launchManager = UTLaunchManager()
    }
    
    func configurationKeyboard() {
        IQKeyboardManager.shared.enable = true
        IQKeyboardManager.shared.shouldResignOnTouchOutside = true
    }
    
    func configurationDatas() {
        
    }
    
    func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
        if isForceLandscape {
            return .landscapeRight
        }
        return .portrait
    }
}

